package ishitong.vehicleManagement.service.biz.impl;

import ishitong.vehicleManagement.dao.StealRobVehicleDao;
import ishitong.vehicleManagement.model.StealRobVehicle;
import ishitong.vehicleManagement.model.StealRobVehicleQuery;
import ishitong.vehicleManagement.service.biz.StealRobVehicleService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ishitong.platform.common.page.Page;

/** @pdOid 042eaeda-02c1-4d9e-ab1e-ed826a7a88c8
 * @创建日期:2013-09-27 12:15:24
 * 
 * @功能描述:RVIMS_StealRobVehicle业务服务
 * @开发人员:福建视通 */
@Service(value="stealRobVehicleService")
@Transactional
public class StealRobVehicleServiceImpl implements StealRobVehicleService {
   /** @pdOid bfb8caeb-986e-4f62-856a-80caf7a62a41
       @pdRoleInfo migr=yes name=StealRobVehicleDao assc=association4 */
   @Autowired
   private StealRobVehicleDao stealRobVehicleDao;
   /** @pdOid 391b4c2d-d358-44b3-89b8-81b75ef46ef1
       @pdRoleInfo migr=yes name=SPIVehicleService assc=association9 */
   @Autowired
   private SPIVehicleService spiVehicleService;
   /** @pdOid 64ff6a77-4052-46cd-9755-126905e6cd19
       @pdRoleInfo migr=yes name=SPISysCodeService assc=association15 */
   @Autowired
   private SPISysCodeService spiSysCodeService;
   
   /** @param srv
    * @pdOid 71b01099-e032-4f9f-8065-7b2571c28c82 */
   private void setStealRobVehicleProperty(StealRobVehicle srv) {
    srv.setPlateColor(spiSysCodeService.getSysCodeById( srv.getPlateColorId()));
    srv.setPlateType(spiSysCodeService.getSysCodeById(srv.getPlateTypeId()));
    srv.setUsingCharacter(spiSysCodeService.getSysCodeById(srv.getUsingCharacterId()));
    srv.setVehicleClassification(spiSysCodeService.getSysCodeById(srv.getVehicleClassificationId()));
    srv.setVehicleColor(spiSysCodeService.getSysCodeById(srv.getVehicleColorId()));
    srv.setVehicleType(spiSysCodeService.getSysCodeById(srv.getVehicleTypeId()));
   }
   
   /** @param id
    * @pdOid f42b0187-fe78-4d87-a790-fbca6eaa69b7
    * @功能描述: 删除RVIMS_StealRobVehicle
    * @异常类型: */
   public void delete(String id) {
   	if(id!=null&&!id.trim().equals("")){
   		String[] idList=id.split(";");
   		for(int i=0;i<idList.length;i++){
   			if(idList[i]!=null&&!idList[i].trim().equals("")){
   				this.stealRobVehicleDao.remove(idList[i]);
   			}
   		}
   	}
   }
   
   /** @param stealRobVehicle
    * @pdOid 0b338268-2c6a-4ae1-aabf-ae23d9aebd2b
    * @功能描述: 删除RVIMS_StealRobVehicle
    * @异常类型: */
   public void deleteByModel(StealRobVehicle stealRobVehicle) {
   	this.stealRobVehicleDao.remove(stealRobVehicle);
   }
   
   /** @param id
    * @pdOid 2de4605c-ba83-4168-b7bc-1d2a1ba1e777
    * @功能描述: 查询RVIMS_StealRobVehicle
    * @异常类型: */
   public StealRobVehicle findById(String id) {
    StealRobVehicle stealRobVehicle = this.stealRobVehicleDao.findByPrimaryKey(id);
    setStealRobVehicleProperty(stealRobVehicle);
   	return stealRobVehicle;
   }
   
   /** @param stealRobVehicle
    * @pdOid b6bb5d46-9dae-41a2-8c68-e978fe8b5bf8
    * @功能描述: 新增与修改RVIMS_StealRobVehicle
    * @异常类型: */
   public void save(StealRobVehicle stealRobVehicle) {
   	this.stealRobVehicleDao.save(stealRobVehicle);
   }
   
   /** @param query 
    * @param pageSize 
    * @param pageNum
    * @pdOid ff1bf13e-528d-4936-baf7-b85295a8a123
    * @功能描述: 通过StealRobVehicleQuery对象，查询RVIMS_StealRobVehicle
    * @异常类型: */
   public Page findPage(StealRobVehicleQuery query, int pageSize, int pageNum) {
    Page<StealRobVehicle> page = this.stealRobVehicleDao.findPage(query,pageSize,pageNum);
     List<StealRobVehicle> lst = page.getResults();
     for (StealRobVehicle srv: lst) {
     	setStealRobVehicleProperty(srv);
     }
   	return page;
   }
   
   /** @param query
    * @pdOid 54f8a10a-4ad2-4ab6-8e6a-fa0a98cfa632
    * @功能描述: 通过StealRobVehicleQuery对象，查询RVIMS_StealRobVehicle
    * @异常类型: */
   public List<StealRobVehicle> findList(StealRobVehicleQuery query) {
   	return this.stealRobVehicleDao.findList(query);
   }

}